home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / utils / cosaque / cosaque6.s < prev   
Text File  |  1980-01-03  |  43KB  |  1,927 lines

  1. *******************************************************************************
  2. * Cosaque v3.01 (GUI)                       Copyright © 1994 The Art/LSd
  3. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  4. * $Release    : 3.01 $
  5. * $Revision    : 1.00 $
  6. * $Date        : 14-Apr-94 $
  7. *
  8. * $Author(s)    : Written by The Art/LSd (In MC680x0 Assembly under Asm-One)
  9. * $Note(s)    : Position Independacy off a4 - (WARNING: DON`T TRASH A4!)
  10. *        : SysBase Ptr is cached so that if running in fastmem access
  11. *        : to SysBase ptr is faster. Requires Case Sensitivity enabled.
  12. *
  13. * $Purpose    : Nice and Simple sine generation tool with easy to use GUI
  14. *******************************************************************************
  15. CONTEXT_ERROR    =    2            /* create context failcode */
  16. GADGETS_ERROR    =    3            /* create gadgets failcode */
  17. MENUS_ERROR    =    4            /* create menus failcode */
  18. WINDOW_ERROR    =    5            /* open window failcode */
  19. FONT_ERROR    =    6            /* open font failcode */
  20. SCREEN_ERROR    =    7            /* open screen failecode */
  21. VISUAL_ERROR    =    8            /* get visual info failcode */
  22.  
  23. _LVOSPMul    =    -$4E
  24. _LVOSPFix    =    -$1E
  25. _LVOSPFlt    =    -$24
  26. _LVOSPDiv    =    -$54
  27. _LVOSPAdd    =    -$42
  28. _LVOSPSub    =    -$48
  29.  
  30.         incdir    gst:
  31.         include    "os3_gst.i"
  32.  
  33. *-------------- Definition of Main Variables (Public) Block...
  34.  
  35.         STRUCTURE VarsBlock,0
  36.  
  37.         APTR    _SysBase        /* ExecBase base */
  38.         APTR    _DosBase        /* DOS lib base */
  39.         APTR    _IntuitionBase        /* Intuition lib base */
  40.         APTR    _GfxBase        /* Graphics lib base */
  41.         APTR    _GadToolsBase        /* GadTools lib base */
  42.         APTR    _IconBase        /* Icon lib base */
  43.         APTR    _WBBase            /* Workbench lib base */
  44.  
  45.         APTR    _ScreenPt
  46.         APTR    _VisualInfo
  47.         APTR    _WindowPt
  48.         APTR    _GUI_GList
  49. ;        APTR    _GUI_Menus
  50.         APTR    _UserPort
  51.         APTR    _AppIcon        /* Application icon (OS2.x+) */
  52.         APTR    _AppMsgPort        /* message ReplyPort (App) */
  53.         APTR    _DiskObj
  54.  
  55.         APTR    _AslBase        ;Asl lib base
  56.         APTR    Asl_Request        ;Requester struct
  57.         STRUCT    PathBuffer,200        ;filepath string buffer
  58.  
  59.         LABEL    vars_SIZEOF
  60.  
  61. ********************************************************************************
  62. *-------------- Allocate our variables block
  63.  
  64. Startup:    move.l    d0,d7            ;save CLI params len
  65.         move.l    a0,a5            ;save CLI params ptr
  66.         suba.l    a1,a1            ;clear a1
  67.         move.l    4.w,a6            ;get execbase
  68.         CALL    FindTask        ;find *THIS* task
  69.         move.l    d0,a4            ;get task ptr
  70.         move.l    d7,d0            ;restore CLI params len
  71.         move.l    a5,a0            ;restore CLI params ptr
  72.         tst.l    pr_CLI(a4)        ;did we originate from CLI?
  73.         bne.s    ProgStart        ;yes... call our program
  74.         lea    pr_MsgPort(a4),a0    ;from wb.. handle wb_startup
  75.         move.l    a0,a4
  76.         CALL    WaitPort        ;wait for a message
  77.         move.l    a4,a0
  78.         CALL    GetMsg            ;then get it
  79.         move.l    d0,-(sp)
  80.         bsr.s    ProgStart
  81.         move.l    d0,d7            ;save CLI Return code
  82.         move.l    4.w,a6
  83.         CALL    Forbid
  84.         move.l    (sp)+,a1
  85.         CALL    ReplyMsg
  86.         move.l    d7,d0            ;exit code
  87.         rts
  88.  
  89. ProgStart:    move.l    #vars_SIZEOF,d0        ;length for our variables
  90.         move.l    #MEMF_PUBLIC+MEMF_CLEAR,d1 ;we want public mem, cleared
  91.         move.l    (AbsExecBase).w,a6    ;get SysBase
  92.         CALL    AllocMem        ;allocate it...
  93.         move.l    d0,a4            ;ptr to our RS.Variables base
  94.         bne.s    RSValid            ;did the alloc fail, if so exit
  95.         moveq    #VAR_ERROR,d0        ;Memory allocation fail code
  96.         rts
  97.  
  98. RSPtr:        dc.l    0
  99.  
  100. *-------------- From here a4 points to our variables area (DON`T DESTROY A4!)
  101.  
  102. RSValid:    move.l    a6,_SysBase(a4)        ;cache execptr in publicmem
  103.         lea    RSPtr(pc),a0
  104.         move.l    a4,(a0)    
  105.  
  106. *-------------- Open all libs we want to use
  107.  
  108.         lea    LibTags(pc),a0        ;pt to library script
  109.         bsr.w    OpenTagLibs        ;open libraries
  110.         beq.w    ShutDown        ;if failed to open.. exit
  111.  
  112. *-------------- Allocate ASL Requester
  113.  
  114.         move.l    _AslBase(a4),a6        ;get asl base in a6
  115.         moveq    #ASL_FileRequest,d0    ;requester type
  116.         lea    MainTags(pc),a0        ;taglist
  117.         CALL    AllocAslRequest        ;allocate asl request struct
  118.         move.l    d0,Asl_Request(a4)    ;save request struct
  119.         beq.w    ShutDown
  120.  
  121. *-------------- Open Main Screen & Window
  122.  
  123. Restart:    bsr.w    SetupScreen        ;open our screen
  124.         bne.w    ShutDown        ;exit if error occurs...
  125.  
  126. *-------------- set sine generation defaults
  127.  
  128.         move.w    #COS_YES,SineType        ;COS OR JUMP
  129.         move.l    #NORMAL,DirType            ;NORMAL OR UPSIDEDOWN
  130.         move.l    #0,CosMin            ;COS.MIN
  131.         move.l    #100,CosMax            ;COS.MAX
  132.         move.l    #100,NrData            ;NR. OF DATA
  133.         move.w    #SOURCE,SaveType        ;SOURCE or DATA
  134.         move.w    #"b",_DataType            ;DATA TYPE (b,w,l)
  135.         move.w    #_BYTE,SizeType            ;* DON`T FORGET THIS! *
  136.  
  137.         bsr.w    OpenWindow        ;open our window
  138.         bne.w    ShutDown        ;exit if error occurs...
  139.  
  140.         move.l    _GUI_GList(a4),a0
  141.         move.l    _WindowPt(a4),a1
  142.         suba.l    a2,a2
  143.         moveq    #12,d0
  144.         CALLREL    RefreshGList,_IntuitionBase
  145.  
  146. *-------------- Check for Intuition events and take appropriate actions
  147.         
  148. OSWaitLoop:    move.l    _UserPort(a4),a0    ;a0-->user port
  149.         CALLREL    WaitPort,_SysBase    ;wait for something to happen
  150.  
  151.         move.l    _UserPort(a4),a0    ;a0-->window pointer
  152.         CALLREL    GT_GetIMsg,_GadToolsBase
  153.         tst.l    d0            ;was there a message ?
  154.         beq.s    OSWaitLoop        ;if not loop back
  155.  
  156.         move.l    d0,a1            ;a1-->message
  157.         move.l    im_Class(a1),d2        ;d2=IDCMP flags
  158.         move.w    im_Code(a1),d3        ;code ( for VANILLAKEY )
  159.         move.l    im_IAddress(a1),a2    ;save gadget address
  160.         move.w    $26(a0),d0        ;gadgetid
  161.  
  162.         PUSHR    d0
  163.         CALL    GT_ReplyIMsg        ;reply to message
  164.         PULLR    d0
  165.  
  166.         cmp.l    #CLOSEWINDOW,d2
  167.         beq.w    ShutDown
  168.         cmp.l    #GADGETUP,d2        ;class_gadgetup
  169.         beq.s    GadgetEvent
  170.         ;cmp.l    #MENUPICK,d2        ;did user select menu?
  171.         ;beq.w    MenuEvent
  172.         bra.b    OSWaitLoop
  173.  
  174. GadgetEvent    tst.l    gg_UserData(a2)        ;is there a gad jump adr?
  175.         beq.s    OSWaitLoop        ;was a gadget assigned?
  176.         move.l    gg_UserData(a2),a0    ;get gad jump address
  177.         jmp    (a0)            ;jump to gadget routine
  178.  
  179. *-------------- Get Menus event numbers
  180.  
  181. MenuEvent    move.w    d3,d0            ;\
  182.         move.w    d3,d1            ;make copies
  183.         move.w    d3,d2            ;/
  184.         and.w    #%1111100000000000,d2    ;mask out only submenu
  185.         rol.w    #5,d2            ;d2.w=SUBITEM NUMBER
  186.         and.w    #%0000011111100000,d1    ;mask out only item
  187.         lsr.w    #5,d1            ;d1.w=ITEM NUMBER
  188.         and.w    #%0000000000011111,d0    ;d0.w=MENU NUMBER
  189.  
  190.         bsr.s    _Project        ;project menu
  191.         bra.w    OSWaitLoop
  192.  
  193. _Project    tst.w    d0
  194.         beq.s    menu1
  195.         cmp.w    #1,d0
  196.         beq.s    menu2
  197.         cmp.w    #2,d0
  198.         beq.s    menu3
  199.         bra.w    OSWaitLoop
  200. ;----------------------------------------------Menus
  201.         
  202. menu1        tst.w    d1
  203.         beq.s    OpenPrefs
  204.         cmp.w    #1,d1
  205.         beq.s    SaveAs
  206.         cmp.w    #3,d1
  207.         beq.s    About    
  208.         cmp.w    #5,d1            ;quit program selected on menu?
  209.         beq.w    ShutDown
  210.         bra.w    OSWaitLoop
  211.  
  212. menu2        tst.w    d1
  213.         beq.s    ResetDefaults
  214.         cmp.w    #1,d1
  215.         beq.s    LastSaved
  216.         cmp.w    #2,d1
  217.         beq.s    Restore
  218.         bra.w    OSWaitLoop
  219.  
  220. menu3        tst.w    d1
  221.         beq.s    CrIcons
  222.         bra.w    OSWaitLoop
  223.         
  224. ;-------------------------------------------Menu 1 Functions        
  225.  
  226. OpenPrefs    bra.w    OSWaitLoop
  227. SaveAs        bra.w    OSWaitLoop
  228.  
  229. ;-------------------------------------------Menu 2 Functions        
  230.  
  231. ResetDefaults    bra.w    OSWaitLoop
  232. LastSaved    bra.w    OSWaitLoop
  233. Restore        bra.w    OSWaitLoop
  234.  
  235. ;-------------------------------------------Menu 3 Functions        
  236. CrIcons        bra.w    OSWaitLoop
  237.  
  238.  
  239. ***********************************************************
  240.  
  241.  
  242. About        lea    btxt(pc),a1
  243.         lea    bmsg(pc),a2
  244.         move.l    a2,b1-btxt(a1)
  245.         lea    ltxt(pc),a2
  246.         lea    lmsg(pc),a5
  247.         move.l    a5,b2-btxt(a1)
  248.         lea    rtxt(pc),a3
  249.         lea    rmsg(pc),a5
  250.         move.l    a5,b3-btxt(a1)
  251.         moveq    #0,d0
  252.         moveq    #0,d1
  253.         move.w    #180,d2
  254.         move.w    #80,d3
  255.         suba.l    a0,a0
  256.         move.l    d5,a6
  257.         move.l    _IntuitionBase(a4),a6
  258.         jsr    -348(a6)
  259.  
  260.         bra.w    OSWaitLoop
  261.  
  262. btxt:        dc.b    0,1,0,0
  263.         dc.w    10,10
  264.         dc.l    0
  265. b1        dc.l    0,0
  266. ltxt:        dc.b    0,1,0,0
  267.         dc.w    5,3
  268.         dc.l    0
  269. b2        dc.l    0,0
  270. rtxt:        dc.b    0,1,0,0
  271.         dc.w    5,3
  272.         dc.l    0
  273. b3        dc.l    0,0
  274. bmsg:        dc.b    'Copyright © 1994 The Art/EX4!',0
  275. lmsg:        dc.b    ' Okay ',0
  276. rmsg:        dc.b    ' Okay ',0
  277.         even
  278.  
  279. GetCosineorJump    move.w    d3,SineType    ;SineType (COS or JUMP) .w
  280.         bra.w    OSWaitLoop
  281.         
  282. NormorReverse    and.l    #$0000ffff,d3
  283.         move.l    d3,DirType    ;DirType (NORMAL or UPSIDEDOWN) .l
  284.         bra.w    OSWaitLoop
  285.  
  286. DatType        move.w    d3,SaveType    ;SaveType (SOURCE or DATA) .w
  287.         bra.w    OSWaitLoop
  288.  
  289. Word        tst.w    d3
  290.         bne.s    notbyte
  291.         move.w    #"b",_DataType
  292.         move.w  #_BYTE,SizeType
  293.         bra.w    OSWaitLoop
  294.  
  295. notbyte:    cmp.w    #1,d3
  296.         bne.s    notword        
  297.         move.w    #"w",_DataType
  298.         move.w  #_WORD,SizeType
  299.         bra.w    OSWaitLoop
  300.  
  301. notword:    move.w    #"l",_DataType
  302.         move.w  #_LONG,SizeType        
  303.         bra.w    OSWaitLoop
  304.  
  305.  
  306. MinSize        lea     GUI_Gadgets+3*4(pc),a0
  307.         move.l    (a0),a0
  308.         move.l    34(a0),a0
  309.         move.l    (a0),a0
  310.         lea    -11*4(a0),a0
  311.         move.l    (a0),CosMin
  312.         bra.w    OSWaitLoop
  313.  
  314. MaxSize
  315.         lea     GUI_Gadgets+4*4,a0
  316.         move.l    (a0),a0
  317.         move.l    34(a0),a0
  318.         move.l    (a0),a0
  319.         lea    -11*4(a0),a0
  320.         move.l    (a0),CosMax
  321.         bra.w    OSWaitLoop
  322.  
  323. Number        lea     GUI_Gadgets+5*4,a0
  324.         move.l    (a0),a0
  325.         move.l    34(a0),a0
  326.         move.l    (a0),a0
  327.         lea    -11*4(a0),a0
  328.         move.l    (a0),NrData
  329.         bra.w    OSWaitLoop
  330.  
  331.  
  332. CreateSine    move.l    CosMin,d0
  333.         move.l    CosMax,d1
  334.         beq.s    skip
  335.         cmp.l    d0,d1
  336.         ble.s    skip
  337.         tst.l    NrData
  338.         beq.s    skip
  339.  
  340.         move.l    a4,-(sp)
  341.  
  342.         move.l    CosMin,_temp1
  343.         move.l    CosMax,_temp2
  344.         move.l    NrData,_temp3
  345.  
  346.         bsr.w    Do_Sine
  347.  
  348.         move.l    _temp1,CosMin
  349.         move.l    _temp2,CosMax
  350.         move.l    _temp3,NrData
  351.  
  352.         move.l    (sp)+,a4
  353.  
  354. skip        bra.w    OSWaitLoop
  355.  
  356. _temp1:        dc.l    0
  357. _temp2:        dc.l    0
  358. _temp3:        dc.l    0
  359.  
  360. GetSaveReq
  361. *-------------- Example ASL Requester 'SAVE'
  362.  
  363.         move.l    RSPtr(pc),a4
  364.         lea    SaveTags(pc),a1        ;address of taglist
  365.         lea    SaveText(pc),a2        ;ptr to requester hail text
  366.         bsr.b    RequestASL
  367.  
  368. *-------------- put name into gadget
  369.  
  370.         lea    GUI_Gadgets+7*4(pc),a0
  371.         lea    PathBuffer(a4),a2
  372.         bsr    CopyStr2Gad
  373.  
  374.         move.l    _GUI_GList(a4),a0
  375.         move.l    _WindowPt(a4),a1
  376.         suba.l    a2,a2
  377.         moveq    #12,d0
  378.         CALLREL    RefreshGList,_IntuitionBase
  379.         
  380. TypeSaveName:    bra.w    OSWaitLoop
  381.  
  382.  
  383. *******************************************************************************
  384. * RequestASL <NON MODIFIABLE>
  385. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  386. * Prompts user to select a filename using the ASL Requester
  387. *
  388. * $Inputs    : a1.l=Requester Tag Structure (PTR)
  389. *        : a2.l=Requester Hail Text-String (PTR)
  390. * $Outputs    : a0.l=Pathname of selected file, or Points to ZERO if failed
  391. *        : d0.b=Flags 0,cancelled, -1,selected
  392. *
  393. * $SR-Flags    : Z-Flag Set if requester cancelled.
  394. *******************************************************************************
  395.  
  396. RequestASL:    move.l    a2,4(a1)        ;hail textptr into tag struct
  397.         move.l    Asl_Request(a4),a0    ;address of requester struc
  398.         move.l    _AslBase(a4),a6        ;get asl base
  399.         CALL    AslRequest        ;do request
  400.         tst.l    d0            ;test d0
  401.         beq.s    cancelled        ;branch if cancelled
  402.  
  403.         lea    PathBuffer(a4),a5
  404.         move.l    Asl_Request(a4),a0    ;address of requester struc
  405.         move.l    rf_Dir(a0),a1        ;get dir string
  406.         move.l    a5,a2            ;get output buffer
  407.         moveq    #56,d0            ;set max size
  408. copy        move.b    (a1)+,(a2)+        ;copy bytes
  409.         dbeq    d0,copy            ;until end of string or buffer
  410.     
  411.         move.l    a5,d1            ;get dir name (copy)
  412.         move.l    rf_File(a0),d2        ;get file name
  413.         move.l    #200,d3            ;size of buffer
  414.         move.l    _DosBase(a4),a6        ;get dos base
  415.         CALL    AddPart            ;create full pathname
  416.         tst.l    d0            ;test for overflow
  417.         beq.s    cancelled        ;branch on error
  418.     
  419.         moveq    #-1,d0            ;initialise count
  420.         move.l    a5,a0            ;address of buffer    
  421. checksize:    addq.w    #1,d0            ;decrement counter
  422.         tst.b    0(a0,d0.w)        ;test for zero terminator
  423.         bne.s    checksize        ;branch if not found
  424.     
  425.         cmpi.w    #37,d0            ;is count too large
  426.         ble.s    sizeok            ;branch if not
  427.         sub.w    #37,d0            ;subtract count from numchars
  428.         add.w    d0,a0            ;add to buff adr so eostr shown
  429. sizeok        st.b    d0            ;d0=$FF.b (Clear Z-Flag)
  430.         rts
  431.  
  432. cancelled    suba.l    a0,a0            ;no filename, clear ptr
  433.         sf.b    d0            ;d0=$00.b (Set Z-Flag)
  434.         rts
  435.  
  436. *******************************************************************************
  437.  
  438. MainTags:    dc.l    ASL_Height,200                ;height
  439.         dc.l    ASL_Width,340                ;width
  440.         dc.l    TAG_DONE                ;end of taglist
  441.  
  442. SaveTags:    dc.l    ASL_Hail,0                ;savetext ptr
  443.         dc.l    ASL_FuncFlags,FILF_SAVE+FILF_PATGAD
  444.         dc.l    TAG_DONE                ;end of taglist
  445.  
  446. SaveText:    dc.b    'Save File',0
  447.         even
  448.  
  449. *******************************************************************************
  450. * Shutdown() - Free all allocated resources & exit program
  451. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  452. * Frees all previously allocated resources, sanity checks are made so only
  453. * allocated memory/open libraries/and so on will be removed if open/alloc`d.
  454. *******************************************************************************
  455. *-------------- Dealloc Open Libraries
  456.  
  457. ShutDown:    move.l    RSPtr(pc),a4
  458.  
  459.         move.l    Asl_Request(a4),d0    ;get request struct
  460.         beq.s    no_asl    
  461.         move.l    d0,a0
  462.         move.l    _AslBase(a4),a6
  463.         move.l    a6,d7
  464.         beq.s    no_asl
  465.         CALL    FreeAslRequest
  466. no_asl
  467.         bsr.w    CloseWindow
  468.         bsr.w    CloseDownScreen
  469.  
  470.         lea    LibTags(pc),a0        ;pt to taglist of libs to close
  471.         bsr.w    CloseTagLibs        ;close all open libs..
  472.  
  473. *-------------- Free RS Variables Area
  474.  
  475. RSFreeMem:    move.l    a4,a1            ;ptr to our RS.Variables base
  476.         move.l    #vars_SIZEOF,d0        ;no. of bytes to free
  477.         move.l    4.w,a6
  478.         CALL    FreeMem            ;free the memory
  479.  
  480.         moveq    #0,d0            ;no return code
  481.         rts                ;exit...
  482.  
  483. *******************************************************************************
  484. * IconifyAsApp()
  485. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  486. * Free`s up as much memory as possible then shuts down window`s & screens. Next
  487. * it Opens up an Application Icon on WB screen and waits for user to select it
  488. * before Restarting Program.
  489. *******************************************************************************
  490.  
  491. IconifyAsApp:    bsr.w    CloseWindow
  492.         bsr.w    CloseDownScreen
  493.         bsr.s    AppIconify
  494.         bra    Restart
  495.  
  496. ;/* [ CloseDownApp ] *********************************************************/
  497. ;Add an Application Icon to WB screen and waits until icon selected then exits.
  498.  
  499. *-------------- Create App Msgport (for reply)
  500.  
  501. AppIconify:    clr.l    _AppMsgPort(a4)
  502.         move.l    _WBBase(a4),d0
  503.         CALLREL    CreateMsgPort,_SysBase        ; make app msgport
  504.         move.l    d0,_AppMsgPort(a4)
  505.         beq.s    FreeApp
  506.  
  507. *-------------- Get DiskObject (For WB AppIcon access)
  508.  
  509.         lea    IconName(pc),a0
  510.         CALLREL    GetDiskObject,_IconBase        ;get icon
  511.         move.l    d0,_DiskObj(a4)
  512.         beq.s    FreeApp
  513.         
  514. *-------------- Create the WB Application Icon
  515.  
  516.         lea    SproName(pc),a0        ; Icon name
  517.         move.l    _AppMsgPort(a4),a1    ; reply port is MSGPort
  518.         suba.l    a2,a2            ; lock (not used as v39)
  519.         move.l    _DiskObj(a4),a3        ; disk object (icon image)
  520.         move.l    a3,d0            ; a3=icon image
  521.         beq.s    NoDiskOb
  522.         moveq    #0,d0            ; id
  523.         moveq    #0,d1            ; userdata
  524.         move.l    _WBBase(a4),a6        ; is there a WB Libray open?
  525.         move.l    a4,-(sp)        ; stack our RS. Area pt
  526.         move.l    d0,a4            ; clear a4 - for OS2 TagCompat!
  527.         CALL    AddAppIconA        ; Call call
  528.         move.l    (sp)+,a4        ; get our RS. area ptr back!
  529.         move.l    d0,_AppIcon(a4)        ; ptr to appicon
  530.  
  531. *-------------- Wait for user to select icon on WB Screen
  532.  
  533. NoDiskOb:    move.l    _SysBase(a4),a6        ; get execbase
  534.         moveq    #0,d6
  535. WaitOnApp:    move.l    _AppMsgPort(a4),a0
  536.         moveq    #0,d0
  537.         moveq    #1,d1
  538.         move.b    15(a0),d1
  539.         bset    d1,d0
  540.         CALL    Wait            ; wait for msg
  541.  
  542.         move.l    _AppMsgPort(a4),a0
  543.         CALL    GetMsg            ; get it...
  544.         tst.l    d0            ; was there a message ?
  545.         beq.s    WaitOnApp        ;if not loop back
  546.  
  547.         move.l    d0,a0
  548.         tst.l    32(a0)            ; appicon selected?
  549.         sne    d6            ; set d6 if so..
  550.         move.l    a0,a1
  551.         CALL    ReplyMsg        ; reply to msg...
  552.         tst.b    d6
  553.         bne.s    WaitOnApp
  554.  
  555. *-------------- Remove Application Icon from Workbench screen (& Kill MsgPort)
  556.  
  557. FreeApp:    move.l    _AppMsgPort(a4),d0
  558.         beq.s    NoPort
  559.         move.l    d0,a0
  560.         CALLREL    DeleteMsgPort,_SysBase    ;delete msgport
  561.         clr.l    _AppMsgPort(a4)
  562.  
  563. *-------------- Free WB Application Icon
  564.  
  565. NoPort:        move.l    _AppIcon(a4),d0        ; Our app icon
  566.         beq.s    No_App
  567.         move.l    d0,a0
  568.         CALLREL    RemoveAppIcon,_WBBase    ; get rid of app icon
  569.         clr.l    _AppIcon(a4)
  570.  
  571. *-------------- Free DiskObject (Used For WB AppIcon access)
  572.  
  573.         move.l    _DiskObj(a4),d0        ; d0=disk object
  574.         beq.s    No_App            ; is it valid, if not skip free
  575.         move.l    d0,a0
  576.         CALLREL    FreeDiskObject,_IconBase ; free up disk object
  577.         clr.l    _DiskObj(a4)
  578. No_App:        rts
  579.  
  580.  
  581.  
  582. *******************************************************************************
  583. * SaveMem2File
  584. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  585. * $Inputs:    a0.l    = Filename
  586. *        a1.l    = Mem Address
  587. *        d0.l    = Save Length
  588. *
  589. * $Outputs:    d0.l    = 0 - success
  590. *        d0.l    = 1 - failure
  591. *******************************************************************************
  592.  
  593. SaveMem2File:    movem.l    d2-d7/a0-a6,-(sp)
  594.  
  595.         move.l    a0,d1            ;filename
  596.         move.l    a1,d5            ;progbuffer
  597.         move.l    d0,d6            ;proglength
  598.         move.l    #MODE_NEWFILE,d2
  599.         move.l    _DosBase(a4),a6
  600.         jsr    _LVOOpen(a6)
  601.  
  602.         move.l    d0,d7
  603.         beq.b    _SaveError
  604.         move.l    d7,d1            ;fh...
  605.         move.l    d5,d2            ;adr
  606.         move.l    d6,d3            ;length
  607.         jsr    _LVOWrite(a6)        ;write file
  608.  
  609.         move.l    d7,d1
  610.         jsr    _LVOClose(a6)        ;close file
  611.  
  612.         movem.l    (sp)+,d2-d7/a0-a6
  613.         moveq    #0,d0
  614.         rts
  615.  
  616. _SaveError:    movem.l    (sp)+,d2-d7/a0-a6
  617. remcode        moveq    #1,d0
  618.         rts
  619.             
  620. ******************************************************************************
  621. * OpenTagLibs() <NON MODIFIABLE> 
  622. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  623. * $Inputs    : a0.l    = Taglist Pt
  624. * $Format eg;    : dc    DOSName-*,_DOSBase,36
  625. *
  626. * $Outpus    : d0.b  = $FF.B if FAILED & $00.B if OKAY
  627. * $SR-Flags    : Z-Flag cleared on FAIL
  628. ******************************************************************************
  629.         
  630. OpenTagLibs:    PUSH    d1-d7/a1-a3/a5-a6    ;save registers
  631.         move.l    _SysBase(a4),a6        ;execbase in a6
  632.         move.l    a0,a5
  633. .find_tag:    tst.w    (a5)            ;TAG_DONE?
  634.         beq.s    .tag_done        ;end of taglist?
  635.         move.l    a5,a1            ;start of script
  636.         add.w    (a5)+,a1        ;a1=library name pt
  637.         moveq    #0,d7            ;clear d7
  638.         move.l    d7,d0            ;clear d0 for version no.
  639.         move.w    (a5)+,d7        ;d7=_XXXBase pt
  640.         move.w    (a5)+,d0        ;d0=lib version.
  641.         PUSHR    a1            ;stack libname pt
  642.         CALL    OpenLibrary        ;try to open desired library
  643.         PULLR    a1            ;get libname pt
  644.         move.l    d0,(a4,d7.w)        ;save lib base (to RS.)
  645.         bne.s    .find_tag        ;did it open? if so open next..
  646.         sf.b    d0            ;set Z Flag (d0=$00.B) FAILED!
  647.         bra.s    .pullexit        ;clean up stack and return
  648. .tag_done:    st.b    d0            ;clear Z Flag (d0=$FF.B) OKAY!
  649. .pullexit:    PULL    d1-d7/a1-a3/a5-a6    ;restore registers
  650.         tst.b    d0
  651.         rts                ;libraries opened succefully!
  652.  
  653. CloseTagLibs:    PUSH    d0-d7/a0-a3/a5-a6    ;save registers
  654.         move.l    a0,a5            ;make copy of taglist ptr
  655.         move.l    4.w,a6            ;execbase in a6
  656. .find_tag:    tst.w    (a0)+            ;TAG_DONE?
  657.         beq.s    .tag_done        ;end of taglist?
  658.         move.l    a4,a1            ;get RS. base
  659.         add.w    (a0)+,a1        ;create LibBase pt
  660.         move.l    (a1),d0            ;is this library open?
  661.         beq.s    .find_tag        ;no.. so don`t close it..
  662.         move.l    d0,a1            ;base of library to close
  663.         tst.w    (a0)+            ;skip version
  664.         PUSHR    a0            ;stack script pt
  665.         CALL    CloseLibrary        ;close this library
  666.         PULLR    a0            ;get script pt
  667.         bra.s    .find_tag        ;next tagitem please!
  668. .tag_done:    PULL    d0-d7/a0-a3/a5-a6    ;restore registers
  669. script_done:    rts                ;all open libraries closed..
  670.  
  671. LibTags:    dc    DOSName-*,_DosBase,36
  672.         dc    INTName-*,_IntuitionBase,36
  673.         dc    GFXName-*,_GfxBase,36
  674.         dc    GTName-*,_GadToolsBase,36
  675.         dc    ICName-*,_IconBase,36
  676.         dc    WBName-*,_WBBase,0
  677.         dc    ASLName-*,_AslBase,36
  678.         dc    TAG_DONE
  679.  
  680. IR:        dc.l    GTBB_Recessed,1
  681. NR:        dc.l    GT_VisualInfo,0
  682.         dc.l    TAG_DONE
  683.  
  684. DOSName:    dc.b    "dos.library",0
  685. INTName:    dc.b    "intuition.library",0
  686. GFXName:    dc.b    "graphics.library",0
  687. GTName:        dc.b    "gadtools.library",0
  688. WBName:        dc.b    "workbench.library",0
  689. ICName:        dc.b    "icon.library",0
  690. ASLName:    dc.b    "asl.library",0    
  691.         even
  692.         cnop    0,4
  693.  
  694. SetupScreen:    move.l    PubScreenName(pc),a0
  695.         move.l    _IntuitionBase(a4),a6
  696.         jsr    _LVOLockPubScreen(a6)
  697.         move.l    d0,_ScreenPt(a4)
  698.         beq.s    SError
  699.  
  700.         move.l    _ScreenPt(a4),a0
  701.         lea    TD(pc),a1
  702.         move.l    _GadToolsBase(a4),a6
  703.         jsr    _LVOGetVisualInfoA(a6)
  704.         move.l    d0,_VisualInfo(a4)
  705.         beq.s    VError
  706.  
  707.         moveq    #0,d0
  708.         rts
  709.  
  710. SError:     moveq   #1,d0
  711.         rts
  712. VError:        moveq   #2,d0
  713.         rts
  714.  
  715.  
  716.  
  717. WindowRender:
  718.     movem.l d0-d5/a0-a2/a6,-(sp)
  719.  
  720.     move.l  _WindowPt(a4),a0
  721.     move.b  wd_BorderLeft(a0),d4
  722.     ext.w   d4
  723.     move.b  wd_BorderTop(a0),d5
  724.     ext.w   d5
  725.     move.l  _VisualInfo(a4),NR+4
  726.     move.l  _VisualInfo(a4),IR+4
  727.     move.l  _WindowPt(a4),a0
  728.     move.l  wd_RPort(a0),a2
  729.     move.l  a2,a0
  730.     lea.l   IR,a1
  731.     move.w  #4,d0
  732.     add.w   d4,d0
  733.     move.w  #110,d1
  734.     add.w   d5,d1
  735.     move.w  #60,d2
  736.     move.w  #14,d3
  737.     move.l  _GadToolsBase(a4),a6
  738.     jsr     _LVODrawBevelBoxA(a6)
  739.  
  740.     move.l  _WindowPt(a4),a0
  741.     move.l  wd_RPort(a0),a0
  742.     lea.l   GUI_Text0(pc),a1
  743.     move.l  d4,d0
  744.     move.l  d5,d1
  745.     move.l  _IntuitionBase(a4),a6
  746.     jsr     _LVOPrintIText(a6)
  747.  
  748.     movem.l (sp)+,d0-d5/a0-a2/a6
  749.     rts
  750.  
  751. OpenWindow:
  752.     movem.l d1-d4/a0-a5/a6,-(sp)
  753.  
  754.     move.l  _ScreenPt(a4),a0
  755.     moveq   #0,d3
  756.     moveq   #0,d2
  757.     move.b  sc_WBorLeft(a0),d2
  758.     move.l  sc_Font(a0),a1
  759.     move.w  ta_YSize(a1),d3
  760.     addq.w  #1,d3
  761.     move.b  sc_WBorTop(a0),d0
  762.     ext.w   d0
  763.     add.w   d0,d3
  764.     move.l  _GadToolsBase(a4),a6
  765.     lea   _GUI_GList(a4),a0
  766.     jsr     _LVOCreateContext(a6)
  767.     move.l  d0,a3
  768.     beq     GUI_CError
  769.  
  770.     movem.w d2-d3,-(sp)
  771.     moveq   #0,d3
  772.     lea.l   GUI_GTags(pc),a5
  773. GUI_GL:
  774.     move.l  _SysBase(a4),a6
  775.     lea.l   GUI_NGads,a0
  776.     move.l  d3,d0
  777.     mulu    #gng_SIZEOF,d0
  778.     add.l   d0,a0
  779.     lea.l   BufNewGad,a1
  780.     moveq   #gng_SIZEOF,d0
  781.     jsr     _LVOCopyMem(a6)
  782.  
  783.     lea.l   BufNewGad,a0
  784.     move.l  _VisualInfo(a4),gng_VisualInfo(a0)
  785.     move.l  #topaz8,gng_TextAttr(a0)
  786.     move.w  gng_LeftEdge(a0),d0
  787.     add.w   (sp),d0
  788.     move.w  d0,gng_LeftEdge(a0)
  789.     move.w  gng_TopEdge(a0),d0
  790.     add.w   2(sp),d0
  791.     move.w  d0,gng_TopEdge(a0)
  792.  
  793.     move.l  _GadToolsBase(a4),a6
  794.     lea.l   GUI_GTypes,a0
  795.     moveq   #0,d0
  796.     move.l  d3,d1
  797.     asl.l   #1,d1
  798.     add.l   d1,a0
  799.     move.w  (a0),d0
  800.     move.l  a3,a0
  801.     lea.l   BufNewGad,a1
  802.     move.l  a5,a2
  803.     jsr     _LVOCreateGadgetA(a6)
  804.     tst.l   d0
  805.     bne.s    GUI_COK
  806.     movem.w (sp)+,d2-d3
  807.     bra     GUI_GError
  808. GUI_COK:
  809.     move.l  d0,a3
  810.     move.l  d3,d0
  811.     asl.l   #2,d0
  812.     lea.l   GUI_Gadgets,a0
  813.     add.l   d0,a0
  814.     move.l  a3,(a0)
  815.     move.l  a3,a0
  816.     move.l  d3,d0
  817.     asl.l   #1,d0
  818.     lea.l   GUI_GTypes,a1
  819.     add.l   d0,a1
  820. GUI_NoGen1:
  821. GUI_TL:
  822.     tst.l   (a5)
  823.     beq.s   GUI_DN
  824.     addq.w  #8,a5
  825.     bra.s   GUI_TL
  826. GUI_DN:
  827.     addq.w  #4,a5
  828.     addq.w  #1,d3
  829.     cmp.w   #GUI__CNT,d3
  830.     bmi     GUI_GL
  831.     movem.w (sp)+,d2-d3
  832.     move.l  _GUI_GList(a4),GUI_WG+4
  833.  
  834. ;    move.l  _GadToolsBase(a4),a6
  835. ;    lea.l   GUI_NewMenu0,a0
  836. ;    lea.l   MTags0,a1
  837. ;    jsr     _LVOCreateMenusA(a6)
  838. ;    move.l  d0,_GUI_Menus(a4)
  839. ;    beq     GUI_MError
  840. ;
  841. ;    move.l  d0,a0
  842. ;    move.l  _VisualInfo(a4),a1
  843. ;    lea.l   MTags1,a2
  844. ;    jsr     _LVOLayoutMenusA(a6)
  845.  
  846.     move.w  GUI_Left,GUI_Zoom
  847.     move.w  GUI_Top,GUI_Zoom+2
  848.  
  849.     move.l  _GfxBase(a4),a6
  850.     move.l  _ScreenPt(a4),a1
  851.     lea.l   sc_RastPort(a1),a1
  852.     lea.l   GUI_WTitle,a0
  853.     move.l  #24,d0
  854.     jsr     _LVOTextLength(a6)
  855.     add.w   #80,d0
  856.     move.w  d0,GUI_Zoom+4
  857.  
  858.     move.l  _ScreenPt(a4),a0
  859.     move.b  sc_WBorTop(a0),d0
  860.     ext.w   d0
  861.     lea.l   sc_RastPort(a0),a0
  862.     add.w   rp_TxHeight(a0),d0
  863.     addq.w  #1,d0
  864.     move.w  d0,GUI_Zoom+6
  865.     moveq   #0,d0
  866.     move.w  GUI_Left,d0
  867.     move.l  d0,GUI_L+4
  868.     move.w  GUI_Top,d0
  869.     move.l  d0,GUI_T+4
  870.     move.w  GUI_Width,d0
  871.     move.l  d0,GUI_W+4
  872.     move.w  GUI_Height,d0
  873.     add.w   d3,d0
  874.     move.l  d0,GUI_H+4
  875.  
  876.     move.l  _IntuitionBase(a4),a6
  877.     suba.l  a0,a0
  878.     lea    GUI_WindowTags(pc),a1
  879.     jsr     _LVOOpenWindowTagList(a6)
  880.     move.l  d0,_WindowPt(a4)        ;did window open?
  881.     beq    GUI_WError
  882.  
  883.     move.l    d0,a0                ;window pt
  884.     move.l    wd_UserPort(a0),_UserPort(a4)    ;save user port
  885. ;    move.l   _GUI_Menus(a4),a1
  886. ;    jsr    _LVOSetMenuStrip(a6)
  887.  
  888. *-------------- set default save filename...
  889.  
  890.         lea    GUI_Gadgets+7*4(pc),a0
  891.         lea    fname,a2
  892.         bsr    CopyStr2Gad
  893.  
  894.         lea     GUI_Gadgets+4*4(pc),a0
  895.         move.l    (a0),a0
  896.         move.l    34(a0),a0
  897.         move.l    (a0),a0
  898.         move.b    #"1",(a0)
  899.         move.b    #"0",1(a0)
  900.         move.b    #"0",2(a0)
  901.  
  902.         lea     GUI_Gadgets+5*4(pc),a0
  903.         move.l    (a0),a0
  904.         move.l    34(a0),a0
  905.         move.l    (a0),a0
  906.         move.b    #"1",(a0)
  907.         move.b    #"0",1(a0)
  908.         move.b    #"0",2(a0)
  909.         
  910.  
  911.     move.l  _GadToolsBase(a4),a6
  912.     move.l  _WindowPt(a4),a0
  913.     suba.l  a1,a1
  914.     jsr     _LVOGT_RefreshWindow(a6)
  915.  
  916.     bsr     WindowRender
  917.  
  918.     moveq   #0,d0
  919. GUI_Done:
  920.     movem.l (sp)+,d1-d4/a0-a5/a6
  921.     rts
  922.  
  923. GUI_CError:
  924.     moveq   #1,d0
  925.     bra.s   GUI_Done
  926. GUI_GError:
  927.     moveq   #2,d0
  928.     bra.s   GUI_Done
  929. GUI_MError:
  930.     moveq   #3,d0
  931.     bra.s   GUI_Done
  932. GUI_WError:
  933.     moveq   #4,d0
  934.     bra.s   GUI_Done
  935.  
  936. *******************************************************************************
  937. * [CLOSE GUI]
  938. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  939. *******************************************************************************
  940.  
  941. CloseDownScreen    move.l    _VisualInfo(a4),d0
  942.         beq.s   NoVis
  943.         move.l    d0,a0
  944.         CALLREL    FreeVisualInfo,_GadToolsBase
  945.         clr.l    _VisualInfo(a4)
  946.  
  947. NoVis:        suba.l  a0,a0
  948.         move.l  _ScreenPt(a4),a1
  949.         cmpa.l  a0,a1
  950.         beq.s   NoScr
  951.         CALLREL    UnlockPubScreen,_IntuitionBase
  952.         clr.l  _ScreenPt(a4)
  953. NoScr:        rts
  954.  
  955. CloseWindow:    ;move.l    _GUI_Menus(a4),d0            ;any menus?
  956. ;        beq.s    no_menus
  957. ;        move.l    d0,d7
  958. ;        move.l   _WindowPt(a4),a0
  959. ;        CALLREL    ClearMenuStrip,_IntuitionBase
  960. ;        move.l    d7,a0
  961. ;        CALLREL    FreeMenus,_GadToolsBase
  962. ;        clr.l    _GUI_Menus(a4)
  963.  
  964. no_menus:    move.l    _WindowPt(a4),d0
  965.         beq.s    no_window
  966.         move.l    d0,a0
  967.         CALLREL    CloseWindow,_IntuitionBase
  968.         clr.l    _WindowPt(a4)
  969.  
  970. no_window:    move.l    _GUI_GList(a4),d0
  971.         beq.s    no_gadgets
  972.         move.l    d0,a0
  973.         CALLREL    FreeGadgets,_GadToolsBase
  974.         clr.l    _GUI_GList(a4)
  975. no_gadgets:    rts
  976.  
  977.  
  978.  
  979.  
  980. GD_Gadget00                            EQU    0
  981. GD_Gadget10                            EQU    1
  982. GD_Gadget20                            EQU    2
  983. GD_Gadget30                            EQU    3
  984. GD_Gadget40                            EQU    4
  985. GD_Gadget50                            EQU    5
  986. GD_Gadget60                            EQU    6
  987. GD_Gadget70                            EQU    7
  988. GD_Gadget80                            EQU    8
  989. GD_Gadget90                            EQU    9
  990. GD_Gadget100                           EQU    10
  991. GD_Gadget110                           EQU    11
  992. GD_Gadget120                           EQU    12
  993. GD_Gadget130                           EQU    13
  994.  
  995. GUI__CNT    EQU    14
  996.  
  997. PubScreenName:
  998.     DC.L    WB_Name
  999. WB_Name:
  1000.     DC.B    'Workbench',0
  1001.     CNOP  0,2
  1002.  
  1003. MTags0:        dc.l    GTMN_FrontPen,1
  1004.         dc.l    GTMN_NewLookMenus,1
  1005.         dc.l    TAG_DONE
  1006. MTags1:
  1007.    dc.l    TAG_DONE
  1008. GUI_Zoom:
  1009.     DC.W    0,0,0,0
  1010. GUI_Gadgets:
  1011.     DCB.L    14,0
  1012. BufNewGad:
  1013.     DC.W    0,0,0,0
  1014.     DC.L    0,0
  1015.     DC.W    0
  1016.     DC.L    0,0,0
  1017. TD:
  1018.     DC.L    TAG_DONE
  1019. CL:
  1020.     DC.L    GT_VisualInfo,0,TAG_DONE
  1021. GUI_Left:
  1022.     DC.W    98
  1023. GUI_Top:
  1024.     DC.W    31
  1025. GUI_Width:
  1026.     DC.W    310
  1027. GUI_Height:
  1028.     DC.W    144
  1029.  
  1030. GUI_GTypes:
  1031.     DC.W    CYCLE_KIND
  1032.     DC.W    CYCLE_KIND
  1033.     DC.W    CYCLE_KIND
  1034.     DC.W    INTEGER_KIND
  1035.     DC.W    INTEGER_KIND
  1036.     DC.W    INTEGER_KIND
  1037.     DC.W    BUTTON_KIND
  1038.     DC.W    STRING_KIND
  1039.     DC.W    BUTTON_KIND
  1040.     DC.W    BUTTON_KIND
  1041.     DC.W    CYCLE_KIND
  1042.     DC.W    TEXT_KIND
  1043.     DC.W    BUTTON_KIND
  1044.     DC.W    BUTTON_KIND
  1045.  
  1046.  
  1047. GUI_NGads:
  1048.     DC.W    4,15,110,15
  1049.     DC.L    Gadget00Text,0
  1050.     DC.W    GD_Gadget00
  1051.     DC.L    PLACETEXT_ABOVE,0,GetCosineorJump
  1052.  
  1053.     DC.W    4,76,111,15
  1054.     DC.L    Gadget10Text,0
  1055.     DC.W    GD_Gadget10
  1056.     DC.L    PLACETEXT_ABOVE,0,Word
  1057.  
  1058.     DC.W    4,45,111,15
  1059.     DC.L    Gadget20Text,0
  1060.     DC.W    GD_Gadget20
  1061.     DC.L    PLACETEXT_ABOVE,0,DatType
  1062.  
  1063.     DC.W    237,15,57,15
  1064.     DC.L    Gadget30Text,0
  1065.     DC.W    GD_Gadget30
  1066.     DC.L    PLACETEXT_ABOVE,0,MinSize
  1067.  
  1068.     DC.W    238,46,56,15
  1069.     DC.L    Gadget40Text,0
  1070.     DC.W    GD_Gadget40
  1071.     DC.L    PLACETEXT_ABOVE,0,MaxSize
  1072.  
  1073.     DC.W    241,76,55,15
  1074.     DC.L    Gadget50Text,0
  1075.     DC.W    GD_Gadget50
  1076.     DC.L    PLACETEXT_ABOVE,0,Number
  1077.  
  1078.     DC.W    68,110,20,14
  1079.     DC.L    Gadget60Text,0
  1080.     DC.W    GD_Gadget60
  1081.     DC.L    0,0,GetSaveReq
  1082.  
  1083.     DC.W    91,110,206,14
  1084.     DC.L    0,0                    ;Gadget70Text,0
  1085.     DC.W    GD_Gadget80
  1086.     DC.L    PLACETEXT_IN,0,TypeSaveName
  1087. ;    DC.L    0,0,0
  1088.  
  1089.     DC.W    2,127,105,14
  1090.     DC.L    Gadget80Text,0
  1091.     DC.W    GD_Gadget80
  1092.     DC.L    PLACETEXT_IN,0,About
  1093.  
  1094.     DC.W    197,127,101,14
  1095.     DC.L    Gadget90Text,0
  1096.     DC.W    GD_Gadget90
  1097.     DC.L    PLACETEXT_IN,0,ShutDown        ;was quit selected?
  1098.  
  1099.     DC.W    123,15,106,15
  1100.     DC.L    Gadget100Text,0
  1101.     DC.W    GD_Gadget100
  1102.     DC.L    PLACETEXT_ABOVE,0,NormorReverse
  1103.  
  1104.     DC.W    72,94,222,14
  1105.     DC.L    Gadget110Text,0
  1106.     DC.W    GD_Gadget110
  1107.     DC.L    PLACETEXT_LEFT,0,0
  1108.  
  1109.     DC.W    123,32,107,59
  1110.     DC.L    Gadget120Text,0
  1111.     DC.W    GD_Gadget120
  1112.     DC.L    PLACETEXT_IN,0,CreateSine
  1113.  
  1114.     DC.W    110,127,85,14
  1115.     DC.L    Gadget130Text,0
  1116.     DC.W    GD_Gadget130
  1117.     DC.L    PLACETEXT_IN,0,IconifyAsApp
  1118.  
  1119. GUI_GTags:
  1120.     DC.L    GTCY_Labels,Gadget00Labels
  1121.     DC.L    GT_Underscore,'_'
  1122.     DC.L    TAG_DONE
  1123.  
  1124.     DC.L    GTCY_Labels,Gadget10Labels
  1125.     DC.L    GT_Underscore,'_'
  1126.     DC.L    TAG_DONE
  1127.  
  1128.     DC.L    GTCY_Labels,Gadget20Labels
  1129.     DC.L    GT_Underscore,'_'
  1130.     DC.L    TAG_DONE
  1131.  
  1132.     DC.L    GTIN_Number,0
  1133.     DC.L    GTIN_MaxChars,10
  1134.     DC.L    STRINGA_Justification,GACT_STRINGCENTER
  1135.     DC.L    GT_Underscore,'_'
  1136.     DC.L    TAG_DONE
  1137.  
  1138.     DC.L    GTIN_Number,0
  1139.     DC.L    GTIN_MaxChars,10
  1140.     DC.L    STRINGA_Justification,GACT_STRINGCENTER
  1141.     DC.L    GT_Underscore,'_'
  1142.     DC.L    TAG_DONE
  1143.  
  1144.     DC.L    GTIN_Number,0
  1145.     DC.L    GTIN_MaxChars,10
  1146.     DC.L    STRINGA_Justification,GACT_STRINGCENTER
  1147.     DC.L    TAG_DONE
  1148.  
  1149.     DC.L    TAG_DONE
  1150.  
  1151.     DC.L    GTST_MaxChars,256
  1152.     DC.L    TAG_DONE
  1153.  
  1154.     DC.L    GT_Underscore,'_'
  1155.     DC.L    TAG_DONE
  1156.     DC.L    GT_Underscore,'_'
  1157.     DC.L    TAG_DONE
  1158.     DC.L    GTCY_Labels,Gadget100Labels
  1159.     DC.L    GT_Underscore,'_'
  1160.     DC.L    TAG_DONE
  1161.     DC.L    GTTX_Text,Gadget110String
  1162.     DC.L    GTTX_Border,1
  1163.     DC.L    TAG_DONE
  1164.     DC.L    TAG_DONE
  1165.     DC.L    GT_Underscore,'_'
  1166.     DC.L    TAG_DONE
  1167.  
  1168.  
  1169. Gadget110String:
  1170.     DC.B    '....OK!',0
  1171.     CNOP    0,2
  1172.  
  1173. Gadget00Text:
  1174.     DC.B    '_Sine Type',0
  1175.  
  1176. Gadget10Text:
  1177.     DC.B    'Size of Data',0
  1178.  
  1179. Gadget20Text:
  1180.     DC.B    '_Data Type',0
  1181.  
  1182. Gadget30Text:
  1183.     DC.B    '_Min.',0
  1184.  
  1185. Gadget40Text:
  1186.     DC.B    'Ma_X.',0
  1187.  
  1188. Gadget50Text:
  1189.     DC.B    'Nr Data',0
  1190.  
  1191. Gadget60Text:
  1192.     DC.B    'R',0
  1193.  
  1194. Gadget70Text:
  1195. fname:    DC.B    'Ram:sinedata',0
  1196.  
  1197. Gadget80Text:
  1198.     DC.B    '_About',0
  1199.  
  1200. Gadget90Text:
  1201.     DC.B    '_Quit',0
  1202.  
  1203. Gadget100Text:
  1204.     DC.B    '_Jump Prefs',0
  1205.  
  1206. Gadget110Text:
  1207.     DC.B    'Status:',0
  1208.  
  1209. Gadget120Text:
  1210.     DC.B    'Create Sine',0
  1211.  
  1212. Gadget130Text:
  1213.     DC.B    'A_ppIcon',0
  1214.  
  1215.     CNOP    0,2
  1216.  
  1217. Gadget00Labels:
  1218.     DC.L    Gadget00Lab0
  1219.     DC.L    Gadget00Lab1
  1220.     DC.L    0
  1221.  
  1222. Gadget10Labels:
  1223.     DC.L    Gadget10Lab0
  1224.     DC.L    Gadget10Lab1
  1225.     DC.L    Gadget10Lab2
  1226.     DC.L    0
  1227.  
  1228. Gadget20Labels:
  1229.     DC.L    Gadget20Lab0
  1230.     DC.L    Gadget20Lab1
  1231.     DC.L    0
  1232.  
  1233. Gadget100Labels:
  1234.     DC.L    Gadget100Lab0
  1235.     DC.L    Gadget100Lab1
  1236.     DC.L    0
  1237.  
  1238. Gadget00Lab0:    DC.B    'Cosine',0
  1239. Gadget00Lab1:    DC.B    'Jump',0
  1240.  
  1241.     CNOP    0,2
  1242.  
  1243. Gadget10Lab0:    DC.B    'Byte',0
  1244. Gadget10Lab1:    DC.B    'Word',0
  1245. Gadget10Lab2:    DC.B    'Longword',0
  1246.  
  1247.     CNOP    0,2
  1248.  
  1249. Gadget20Lab0:    DC.B    'Source',0
  1250. Gadget20Lab1:    DC.B    'Data',0
  1251.  
  1252.     CNOP    0,2
  1253.  
  1254. Gadget100Lab0:    DC.B    'Normal',0
  1255. Gadget100Lab1:    DC.B    'Reverse',0
  1256.  
  1257.     CNOP    0,2
  1258.  
  1259. topaz8:
  1260.     DC.L    topazFName8
  1261.     DC.W    8
  1262.     DC.B    $00,$01
  1263.  
  1264. topazFName8:
  1265.     DC.B    'topaz.font',0
  1266.     CNOP    0,2
  1267.  
  1268. GUI_WindowTags:
  1269. GUI_L:
  1270.     DC.L    WA_Left,0
  1271. GUI_T:
  1272.     DC.L    WA_Top,0
  1273. GUI_W:
  1274.     DC.L    WA_Width,0
  1275. GUI_H:
  1276.     DC.L    WA_Height,0
  1277.     DC.L    WA_IDCMP,CYCLEIDCMP!INTEGERIDCMP!IDCMP_GADGETUP!STRINGIDCMP!BUTTONIDCMP!TEXTIDCMP!IDCMP_MENUPICK!IDCMP_CLOSEWINDOW!IDCMP_REFRESHWINDOW
  1278.     DC.L    WA_Flags,WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_CLOSEGADGET!WFLG_SMART_REFRESH!WFLG_ACTIVATE
  1279. GUI_WG:
  1280.     DC.L    WA_Gadgets,0
  1281.     dc.l    WA_NewLookMenus,1
  1282.     DC.L    WA_Title,GUI_WTitle
  1283.     DC.L    WA_Zoom,GUI_Zoom
  1284.     DC.L    WA_AutoAdjust,1
  1285.     DC.L    TAG_DONE
  1286.  
  1287. GUI_WTitle:
  1288.     DC.B    'Cosaque V3.01 The Art/EX4!',0
  1289.     CNOP    0,2
  1290.  
  1291. GUI_Text0:
  1292.     DC.B    1,0
  1293.     DC.B    RP_JAM1
  1294.     DC.B    0
  1295.     DC.W    17,113
  1296.     DC.L    0        ;topaz8
  1297.     DC.L    GUI_IText0
  1298.     DC.L    0
  1299.  
  1300. GUI_IText0:
  1301.     DC.B    'Save',0
  1302.  
  1303. VersionStr:    dc.b    '$VER: '        ;for 'version' command
  1304. SproName:    dc.b    'Cosaque v3.01',0
  1305. IconName:    dc.b    'Cosaque',0        ;for 'cosaque.info'
  1306.         even
  1307.  
  1308. *******************************************************************************
  1309. * COSAQUE - Sinedata Generation Routines
  1310. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1311. *******************************************************************************
  1312.  
  1313. COS_YES        =    0
  1314. COS_NO        =    1
  1315. UPSIDEDOWN    =    -1
  1316. NORMAL        =    1
  1317. SOURCE        =    0
  1318. DATA        =    1
  1319.  
  1320. _BYTE        =    1
  1321. _WORD        =    2
  1322. _LONG        =    4
  1323.         even
  1324.  
  1325.  
  1326. Do_Sine:    bsr    makeit
  1327.         move.l    RSPtr(pc),a4
  1328.         rts
  1329.  
  1330. *-------------- Open MathFFP Library
  1331. makeit:        move.l    4.w,a6
  1332.         lea    MathFFPName(pc),a1
  1333.         jsr    -408(a6)
  1334.         move.l    d0,_MafBase
  1335.         beq.w    MaffError
  1336.  
  1337. *-------------- Set Sinedata parameters
  1338.  
  1339. SetParams:    move.w    _DataType(pc),d6
  1340.         bset    #5,d6
  1341.  
  1342. *-------------- Allocate Binary sinedata
  1343.  
  1344.         move.l    NrData(pc),d0
  1345.         mulu    SizeType(pc),d0            ;alloc length
  1346.         moveq    #0,d1                ;mem type
  1347.         jsr    _LVOAllocMem(a6)
  1348.         move.l    d0,_MemBase            ;membase ptr
  1349.         beq    Alloc_error
  1350.         
  1351.  
  1352.         tst.w    SineType
  1353.         bne.s    MakeJmpSine
  1354.  
  1355.         bsr    _MakeCosSine            ;make 'COS'
  1356.  
  1357.         bra.s    DoSave
  1358.  
  1359. MakeJmpSine:    bsr    _MakeJmpSine            ;make 'JUMP'
  1360.  
  1361. DoSave:        tst.w    SaveType
  1362.         bne.s    DoSave2
  1363.  
  1364. *-------------- Generate source code...
  1365.  
  1366.         move.l    NrData(pc),d0
  1367.         mulu    #8,d0
  1368.         moveq    #0,d1
  1369.         jsr    _LVOAllocMem(a6)
  1370.         move.l    d0,BufferPt
  1371.         beq    ExitFree
  1372.  
  1373.         bsr    GenerateSrc
  1374.  
  1375. *******************************************************************************
  1376. ;a1        =    Start Addr
  1377. ;d0        =    Buffer Length    (of generated source-code to save)
  1378.  
  1379.         movem.l    d0-d7/a0-a6,-(sp)
  1380.  
  1381.         lea     GUI_Gadgets+7*4(pc),a0
  1382.         move.l    (a0),a0
  1383.         move.l    34(a0),a0
  1384.         move.l    (a0),a0                ;a0.l = filename
  1385.  
  1386.         move.l    BufferPt(pc),a1            ;a1.l = mem to save
  1387.         move.l    BufferLen(pc),d0
  1388.         subq.l    #1,d0                ;d0.l = save length
  1389.         move.l    RSPtr(pc),a4
  1390.         bsr    SaveMem2File
  1391.         movem.l    (sp)+,d0-d7/a0-a6
  1392.         
  1393. *******************************************************************************
  1394.  
  1395.         move.l    BufferPt(pc),a1            ;d0
  1396.         move.l    NrData(pc),d0            ;d1
  1397.         mulu    #8,d0                ;d1
  1398.         move.l    4.w,a6
  1399.         jsr    _LVOFreeMem(a6)
  1400.  
  1401.         bra.s    ExitFree
  1402.  
  1403. *-------------- Free Binary Sinedata memory
  1404.  
  1405. DoSave2:    move.l    _MemBase(pc),a0    
  1406.         move.l    NrData(pc),d0
  1407.         mulu    SizeType(pc),d0    
  1408.  
  1409. *******************************************************************************
  1410. ;a0        =    Start Addr
  1411. ;d0        =    Buffer Length    (of Binary to save)
  1412.  
  1413. *-------------- save routine goes here (for Binary data)
  1414.  
  1415.         movem.l    d0-d7/a0-a6,-(sp)
  1416.  
  1417.         lea     GUI_Gadgets+7*4(pc),a0
  1418.         move.l    (a0),a0
  1419.         move.l    34(a0),a0
  1420.         move.l    (a0),a0                ;a0.l = filename
  1421.  
  1422.         move.l    _MemBase(pc),a1
  1423.         move.l    NrData(pc),d0
  1424.         mulu    SizeType(pc),d0    
  1425.         move.l    RSPtr(pc),a4
  1426.         bsr    SaveMem2File
  1427.         
  1428.         movem.l    (sp)+,d0-d7/a0-a6
  1429.  
  1430. *******************************************************************************
  1431.  
  1432. ExitFree    move.l    _MemBase(pc),a1            ;d0
  1433.         move.l    NrData(pc),d0            ;d1
  1434.         mulu    SizeType(pc),d0            ;d1
  1435.         move.l    4.w,a6
  1436.         jsr    _LVOFreeMem(a6)
  1437.  
  1438. *-------------- Close MathFFP Library
  1439. Alloc_error
  1440.         move.l    _MafBase(pc),a1
  1441.         jsr    -414(a6)
  1442. MaffError:    rts
  1443.  
  1444.  
  1445.  
  1446. *******************************************************************************
  1447. * Copy Gadget-data <source> to Record-data <dest>
  1448. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1449. * $Inputs:    a0.l    = string (source)
  1450. *        a2.l    = gadget (dest)
  1451. *******************************************************************************
  1452.  
  1453. CopyGadStr:    move.l    (a0),a0
  1454.         move.l    34(a0),a0
  1455.         move.l    (a0),a0            ;a0=Gadget TextString
  1456.         move.l    a0,a1
  1457.         moveq    #-1,d0
  1458. inclen        addq.l    #1,d0
  1459.         tst.b    (a0)+            ;get string length...
  1460.         bne.s    inclen
  1461.  
  1462. bytecopy    move.b    (a1)+,(a2)+        ;copy byte by byte
  1463.         dbra    d0,bytecopy
  1464.         rts
  1465.  
  1466. *******************************************************************************
  1467. * Copy Record-data <source> TO Gadget-data <dest>
  1468. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1469. * $Inputs:    a0.l    = gadget (dest)
  1470. *        a2.l    = string (source)
  1471. *******************************************************************************
  1472.  
  1473. CopyStr2Gad:    move.l    (a0),a0
  1474.         move.l    34(a0),a0
  1475.         move.l    (a0),a0            ;a0=Gadget TextString
  1476.         move.l    a2,a1
  1477.  
  1478.         moveq    #-1,d0
  1479. inclen2        addq.l    #1,d0
  1480.         tst.b    (a2)+
  1481.         bne.s    inclen2
  1482.  
  1483. bytecopy2    move.b    (a1)+,(a0)+
  1484.         dbra    d0,bytecopy2
  1485.         rts
  1486.  
  1487. ******************************************************************************
  1488. * Sine Binary -> Source 
  1489. *
  1490.  
  1491. GenerateSrc:    move.l    BufferPt(pc),a0
  1492.         move.l    _MemBase(pc),a1
  1493.         moveq    #0,d0
  1494.         move.l    d0,d1
  1495. gen2:        tst.w    d1
  1496.         bne.s    gen3
  1497.         move.b    #10,(a0)+
  1498.         move.b    #9,(a0)+
  1499.         move.b    #'d',(a0)+
  1500.         move.b    #'c',(a0)+
  1501.         move.b    #'.',(a0)+
  1502.         move.w    _DataType(pc),d7    ;either 'b','w' or 'l'
  1503.         move.b    d7,(a0)+
  1504.         move.b    #9,(a0)+
  1505. gen3:        btst    #7,(a1)
  1506.         beq.s    gen4
  1507.  
  1508.         cmp.w    #"b",_DataType
  1509.         bne.s    CheckW3
  1510.         neg.b    (a1)
  1511.         bra.s    nxt3
  1512.  
  1513. CheckW3:    cmp.w    #"w",_DataType
  1514.         bne.s    IsL3
  1515.         neg.w    (a1)
  1516.         bra.s    nxt3
  1517.  
  1518. IsL3        neg.l    (a1)
  1519. nxt3
  1520.         move.b    #$2D,(a0)+
  1521. gen4        clr.l    d7
  1522.  
  1523.         cmp.w    #"b",_DataType
  1524.         bne.s    CheckW2
  1525.         move.b    (a1)+,d7
  1526.         bra.s    nxt2
  1527.         
  1528. CheckW2:    cmp.w    #"w",_DataType
  1529.         bne.s    IsL2
  1530.         move.w    (a1)+,d7
  1531.         bra.s    nxt2
  1532.         
  1533. IsL2:        move.l    (a1)+,d7
  1534. nxt2
  1535.         clr.w    d6
  1536.         move.l    #$2710,d5
  1537. gen5:        divu    d5,d7
  1538.         tst.w    d7
  1539.         bne.s    gen6
  1540.         tst.w    d6
  1541.         bne.s    gen6
  1542.         swap    d7
  1543.         divu    #10,d5
  1544.         tst.w    d5
  1545.         bne.s    gen5
  1546.         move.b    #$30,(a0)+
  1547.         bra.s    gen7
  1548.  
  1549. gen6:        add.w    #$30,d7
  1550.         move.b    d7,(a0)+
  1551.         clr.w    d7
  1552.         swap    d7
  1553.         moveq    #1,d6
  1554.         divu    #10,d5
  1555.         tst.w    d5
  1556.         bne.s    gen5
  1557. gen7:        addq.l    #1,d0
  1558.         cmp.l    NrData(pc),d0
  1559.         beq.s    gen10
  1560.         cmp.w    #7,d1
  1561.         beq.s    gen8
  1562.         move.b    #$2C,(a0)+
  1563. gen8:        addq.w    #1,d1
  1564.         cmp.w    #8,d1
  1565.         bne.s    gen9
  1566.         clr.w    d1
  1567. gen9:        bra    gen2
  1568.  
  1569. gen10:        move.b    #10,(a0)+
  1570.         move.b    #13,(a0)+
  1571.         clr.b    (a0)
  1572.         sub.l    BufferPt(pc),a0
  1573.         move.l    a0,BufferLen
  1574.         rts
  1575.  
  1576. ******************************************************************************
  1577.  
  1578.  
  1579.  
  1580. CalcSine:    move.l    CosMin(pc),d0
  1581.         jsr    _LVOSPFlt(a5)
  1582.         move.l    d0,CosMin
  1583.         move.l    CosMax(pc),d0
  1584.         jsr    _LVOSPFlt(a5)
  1585.         move.l    d0,CosMax
  1586.         move.l    NrData(pc),d0
  1587.         jsr    _LVOSPFlt(a5)
  1588.         move.l    d0,_NoData
  1589.         move.l    DirType(pc),d0
  1590.         jsr    _LVOSPFlt(a5)
  1591.         move.l    d0,DirType
  1592.         rts
  1593.  
  1594. _MakeCosSine:    move.l    _MafBase(pc),a5
  1595.         bsr.s    CalcSine
  1596.         bsr.s    CalcSine2
  1597.         bra.s    CalcSine3
  1598.  
  1599. CalcSine2:    move.l    CosMin(pc),d0
  1600.         move.l    CosMax(pc),d1
  1601.         jsr    _LVOSPAdd(a5)
  1602.         move.l    #$80000042,d1
  1603.         jsr    _LVOSPDiv(a5)
  1604.         move.l    d0,_FFP1
  1605.         move.l    CosMax(pc),d0
  1606.         move.l    CosMin(pc),d1
  1607.         jsr    _LVOSPSub(a5)
  1608.         move.l    #$80000042,d1
  1609.         jsr    _LVOSPDiv(a5)
  1610.         move.l    d0,_FFP2
  1611.         move.l    #$C90FDA43,d0
  1612.         move.l    _NoData(pc),d1
  1613.         jsr    _LVOSPDiv(a5)
  1614.         move.l    d0,_FFP3
  1615.         rts
  1616.  
  1617. CalcSine3:    move.l    NrData(pc),d7
  1618.         subq.l    #1,d7
  1619.         move.l    #'A',_FFP4
  1620.         move.l    _MemBase(pc),a4
  1621. makeffp1:    bsr.s    MakeFFP
  1622.         move.l    _FFP7(pc),d0
  1623.         move.l    _FFP2(pc),d1
  1624.         jsr    _LVOSPMul(a5)
  1625.         move.l    _FFP1(pc),d1
  1626.         jsr    _LVOSPAdd(a5)
  1627.         move.l    #$80000040,d1
  1628.         jsr    _LVOSPAdd(a5)
  1629.         jsr    _LVOSPFix(a5)
  1630.  
  1631. CheckB        cmp.w    #"b",_DataType
  1632.         bne.s    CheckW
  1633.         move.b    d0,(a4)+
  1634.         bra.s    nxt1
  1635.  
  1636. CheckW        cmp.w    #"w",_DataType
  1637.         bne.s    IsL
  1638.         move.w    d0,(a4)+
  1639.         bra.s    nxt1
  1640.  
  1641. IsL        move.l    d0,(a4)+
  1642. nxt1
  1643.         move.l    _FFP4(pc),d0
  1644.         move.l    _FFP3(pc),d1
  1645.         jsr    _LVOSPAdd(a5)
  1646.         move.l    d0,_FFP4
  1647.         dbra    d7,makeffp1
  1648.         rts
  1649.  
  1650. MakeFFP:    movem.l    d0-d7/a0-a4,-(sp)
  1651.         move.l    #$80000041,d2
  1652.         move.l    d2,_FFP5
  1653.         move.l    d2,_FFP6
  1654.         move.l    #$41,_FFP7
  1655.         moveq    #7,d7
  1656. makeffp3:    move.l    _FFP7(pc),d0
  1657.         move.l    _FFP5(pc),d1
  1658.         jsr    _LVOSPAdd(a5)
  1659.         move.l    d0,_FFP7
  1660.         bsr.s    makeffp4
  1661.         move.l    _FFP7(pc),d0
  1662.         move.l    _FFP5(pc),d1
  1663.         jsr    _LVOSPSub(a5)
  1664.         move.l    d0,_FFP7
  1665.         bsr.s    makeffp4
  1666.         dbra    d7,makeffp3
  1667.         movem.l    (sp)+,d0-d7/a0-a4
  1668.         rts
  1669.  
  1670. makeffp4:    moveq    #1,d2
  1671. makeffp5:    move.l    _FFP4(pc),d0
  1672.         move.l    _FFP6(pc),d1
  1673.         jsr    _LVOSPDiv(a5)
  1674.         move.l    _FFP5(pc),d1
  1675.         jsr    _LVOSPMul(a5)
  1676.         move.l    d0,_FFP5
  1677.         move.l    _FFP6(pc),d0
  1678.         move.l    #$80000041,d1
  1679.         jsr    _LVOSPAdd(a5)
  1680.         move.l    d0,_FFP6
  1681.         dbra    d2,makeffp5
  1682.         rts
  1683.  
  1684. _MakeJmpSine:    move.l    _MafBase(pc),a5
  1685.         bsr.s    CalcJmp1
  1686.         bra.s    CalcJmp2
  1687.  
  1688. CalcJmp1:    clr.l    _FFP8
  1689.         cmp.l    #$FFFFFFFF,DirType
  1690.         bne.s    makeffp8
  1691.         move.l    #$800000C1,_FFP8
  1692. makeffp8:    jsr    CalcSine
  1693.         move.l    #$80000042,d0
  1694.         move.l    _NoData(pc),d1
  1695.         jsr    _LVOSPDiv(a5)
  1696.         move.l    d0,_FFP9
  1697.         rts
  1698.  
  1699. CalcJmp2:    move.l    NrData(pc),d7
  1700.         subq.l    #1,d7
  1701.         move.l    #$800000C1,d6
  1702.         move.l    _MemBase(pc),a4
  1703. makeffp9:    move.l    d6,d0
  1704.         bsr.s    makeffp10
  1705.         move.l    #$80000040,d1
  1706.         jsr    _LVOSPAdd(a5)
  1707.         jsr    _LVOSPFix(a5)
  1708.  
  1709. CheckB4        cmp.w    #"b",_DataType
  1710.         bne.s    CheckW4
  1711.         move.b    d0,(a4)+
  1712.         bra.s    nxt4
  1713.         
  1714. CheckW4        cmp.w    #"w",_DataType
  1715.         bne.s    IsL4
  1716.         move.w    d0,(a4)+
  1717.         bra.s    nxt4
  1718.  
  1719. IsL4        move.l    d0,(a4)+
  1720. nxt4
  1721.         move.l    d6,d0
  1722.         move.l    _FFP9(pc),d1
  1723.         jsr    _LVOSPAdd(a5)
  1724.         move.l    d0,d6
  1725.         dbra    d7,makeffp9
  1726.         rts
  1727.  
  1728. makeffp10:    move.l    d0,d1
  1729.         jsr    _LVOSPMul(a5)
  1730.         move.l    _FFP8(pc),d1
  1731.         jsr    _LVOSPAdd(a5)
  1732.         move.l    d0,d2
  1733.         move.l    CosMax(pc),d0
  1734.         move.l    CosMin(pc),d1
  1735.         jsr    _LVOSPSub(a5)
  1736.         move.l    d2,d1
  1737.         jsr    _LVOSPMul(a5)
  1738.         move.l    DirType(pc),d1
  1739.         jsr    _LVOSPMul(a5)
  1740.         move.l    CosMin(pc),d1
  1741.         jmp    _LVOSPAdd(a5)
  1742.  
  1743.  
  1744. _MemBase:    ds.l    1
  1745. BufferPt:    ds.l    1
  1746. BufferLen:    ds.l    1
  1747. _MafBase:    ds.l    1
  1748. _FFP5:        ds.l    1
  1749. _FFP6:        ds.l    1
  1750. _FFP4:        ds.l    1
  1751. _FFP7:        ds.l    1
  1752. _FFP1:        ds.l    1
  1753. _FFP2:        ds.l    1
  1754. _FFP3:        ds.l    1
  1755. _FFP9:        ds.l    1
  1756. _FFP8:        ds.l    1
  1757. CosMin:        ds.l    1
  1758. CosMax:        ds.l    1
  1759. NrData:        ds.l    1
  1760. _NoData:    ds.l    1
  1761. DirType:    ds.l    1
  1762. _DataType    ds.w    1
  1763. _SaveType    ds.w    1
  1764. SaveType:    ds.w    1
  1765. SizeType:    ds.w    1
  1766. SineType:    ds.w    1
  1767.         even    
  1768. MathFFPName:    dc.b    'mathffp.library',0
  1769.                         ;application icon for wb sleep        end
  1770.         end
  1771.  
  1772.  
  1773.     CNOP    0,2
  1774.  
  1775. GUI_NewMenu0:
  1776.     DC.B    NM_TITLE,0
  1777.     DC.L    GUI_MName0
  1778.     DC.L    0
  1779.     DC.W    0
  1780.     DC.L    0,0
  1781.  
  1782. GUI_NewMenu1:
  1783.     DC.B    NM_ITEM,0
  1784.     DC.L    GUI_MName1
  1785.     DC.L    GUI_MComm1
  1786.     DC.W    0
  1787.     DC.L    0,0
  1788.  
  1789. GUI_NewMenu2:
  1790.     DC.B    NM_ITEM,0
  1791.     DC.L    GUI_MName2
  1792.     DC.L    GUI_MComm2
  1793.     DC.W    0
  1794.     DC.L    0,0
  1795.  
  1796. GUI_NewMenu3:
  1797.     DC.B    NM_ITEM,0
  1798.     DC.L    NM_BARLABEL,0
  1799.     DC.W    0
  1800.     DC.L    0,0
  1801.  
  1802. GUI_NewMenu4:
  1803.     DC.B    NM_ITEM,0
  1804.     DC.L    GUI_MName4
  1805.     DC.L    GUI_MComm4
  1806.     DC.W    0
  1807.     DC.L    0,0
  1808.  
  1809. GUI_NewMenu5:
  1810.     DC.B    NM_ITEM,0
  1811.     DC.L    NM_BARLABEL,0
  1812.     DC.W    0
  1813.     DC.L    0,0
  1814.  
  1815. GUI_NewMenu6:
  1816.     DC.B    NM_ITEM,0
  1817.     DC.L    GUI_MName6
  1818.     DC.L    GUI_MComm6
  1819.     DC.W    0
  1820.     DC.L    0,0
  1821.  
  1822. GUI_NewMenu7:
  1823.     DC.B    NM_TITLE,0
  1824.     DC.L    GUI_MName7
  1825.     DC.L    0
  1826.     DC.W    0
  1827.     DC.L    0,0
  1828.  
  1829. GUI_NewMenu8:
  1830.     DC.B    NM_ITEM,0
  1831.     DC.L    GUI_MName8
  1832.     DC.L    GUI_MComm8
  1833.     DC.W    0
  1834.     DC.L    0,0
  1835.  
  1836. GUI_NewMenu9:
  1837.     DC.B    NM_ITEM,0
  1838.     DC.L    GUI_MName9
  1839.     DC.L    GUI_MComm9
  1840.     DC.W    0
  1841.     DC.L    0,0
  1842.  
  1843. GUI_NewMenu10:
  1844.     DC.B    NM_ITEM,0
  1845.     DC.L    GUI_MName10
  1846.     DC.L    GUI_MComm10
  1847.     DC.W    0
  1848.     DC.L    0,0
  1849.  
  1850. GUI_NewMenu11:
  1851.     DC.B    NM_TITLE,0
  1852.     DC.L    GUI_MName11
  1853.     DC.L    0
  1854.     DC.W    0
  1855.     DC.L    0,0
  1856.  
  1857. GUI_NewMenu12:
  1858.     DC.B    NM_ITEM,0
  1859.     DC.L    GUI_MName12
  1860.     DC.L    GUI_MComm12
  1861.     DC.W    0
  1862.     DC.L    0,0
  1863.  
  1864.     DC.B    NM_END,0
  1865.     DC.L    0,0
  1866.     DC.W    0
  1867.     DC.L    0,0
  1868.  
  1869. GUI_MName0:
  1870.     DC.B    'Project',0
  1871.  
  1872. GUI_MName1:
  1873.     DC.B    'Open...',0
  1874.  
  1875. GUI_MComm1:
  1876.     DC.B    'O',0
  1877.  
  1878. GUI_MName2:
  1879.     DC.B    'Save As...',0
  1880.  
  1881. GUI_MComm2:
  1882.     DC.B    'A',0
  1883.  
  1884. GUI_MName4:
  1885.     DC.B    'About...',0
  1886.  
  1887. GUI_MComm4:
  1888.     DC.B    '?',0
  1889.  
  1890. GUI_MName6:
  1891.     DC.B    'Quit...',0
  1892.  
  1893. GUI_MComm6:
  1894.     DC.B    'Q',0
  1895.  
  1896. GUI_MName7:
  1897.     DC.B    'Edit',0
  1898.  
  1899. GUI_MName8:
  1900.     DC.B    'Reset to Defaults',0
  1901.  
  1902. GUI_MComm8:
  1903.     DC.B    'D',0
  1904.  
  1905. GUI_MName9:
  1906.     DC.B    'Last Saved',0
  1907.  
  1908. GUI_MComm9:
  1909.     DC.B    'L',0
  1910.  
  1911. GUI_MName10:
  1912.     DC.B    'Restore',0
  1913.  
  1914. GUI_MComm10:
  1915.     DC.B    'R',0
  1916.  
  1917. GUI_MName11:
  1918.     DC.B    'Settings',0
  1919.  
  1920. GUI_MName12:
  1921.     DC.B    'Create Icons...',0
  1922.  
  1923. GUI_MComm12:
  1924.     DC.B    'I',0
  1925.  
  1926.     CNOP    0,2
  1927.